package br.com.estevam.sisfin.entities;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

import org.apache.tapestry5.beaneditor.NonVisual;
import org.apache.tapestry5.beaneditor.Validate;
import org.apache.tapestry5.beaneditor.Width;
import org.apache.tapestry5.ioc.annotations.Inject;

@Entity
@Table(name = "TblBanco")
public class Banco extends AbstractEntity {
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@NonVisual
	private long id;
	
	@Column(length = 3, nullable = false, unique = true)
	@Validate("required,minlength=1,maxlength=3")
	private int codBanco;

	@Column(length = 50, nullable = false)
	@Validate("required,minlength=1,maxlength=50")
	@Width(30)
	private String descricao;

	@Inject
	public Banco() { }
	
	public Banco(int codBanco, String descricao) {
		super();
		this.codBanco = codBanco;
		this.descricao = descricao;
	}
	
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public int getCodBanco() {
		return codBanco;
	}

	public void setCodBanco(int codBanco) {
		this.codBanco = codBanco;
	}

	public String getDescricao() {
		return descricao;
	}

	public void setDescricao(String descricao) {
		this.descricao = descricao;
	}
	
	public String toString(){
		return "" + id + "---" + getUserId();
	}

}
